<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:t="http://myfaces.apache.org/tomahawk"
				template="/pages/crud_template.xhtml"> 

	<ui:param name="crudBean" value="#{movimentacaoVendasBean}" />
	
	<ui:define name="saveStateObjectsDefined">
		<t:saveState value="#{crudBean.listaEstLojas}" />
		<t:saveState value="#{crudBean.listaBandeiras}" />
		<t:saveState value="#{crudBean.listaProdutos}" />
		<t:saveState value="#{crudBean.listaMovimentoVendasPorDataVenda}" />
		<t:saveState value="#{crudBean.listaMovimentoVendasAgendaFinanceira}" />
		<t:saveState value="#{crudBean.listaMovimentoVendasCupom}" />
		<t:saveState value="#{crudBean.listaParcelasCupom}" />
	</ui:define>
	
	<ui:define name="requiredFieldsMessage">
		<h:outputText value="#{bundle.todosCamposObrigatorios}" rendered="#{crudBean.searching}"/>
	</ui:define>
	
	<ui:define name="content">
		<!-- Painel de Pesquisa - Inicio -->
		<h:panelGroup id="panelGroupDePesquisa" rendered="#{crudBean.searching}">
			<f:subview id="viewBusca">
				<table>
					<tr>
						<td class="tdCor"><h:outputText value="#{bundle.lbl_periodo_vendas}"/> *</td>
						<td class="tdBranco">
							<rich:calendar value="#{crudBean.searchObject.filtro.dataVendaInicial}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
							<h:outputText value=" #{bundle.lbl_ate} "/>
							<rich:calendar value="#{crudBean.searchObject.filtro.dataVendaFinal}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="20%"><h:outputText value="#{bundle.lbl_loja}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu rendered="#{crudBean.exibirListaLojas}" value="#{crudBean.searchObject.filtro.estLoja}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaEstLojas}" />
    						</h:selectOneMenu>
							<h:outputText rendered="#{!crudBean.exibirListaLojas }" value=" #{crudBean.searchObject.filtro.nomeEstLoja} "/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="25%"><h:outputText value="#{bundle.lbl_bandeira}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.bandeiraVo.codigo}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaBandeiras}" />
								<a4j:support event="onchange" reRender="panelGroupDePesquisa" actionListener="#{crudBean.setarListaProdutos}"/>
    						</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="25%"><h:outputText value="#{bundle.lbl_produto}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.produtoVo.codigo}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaProdutos}" />
    						</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td class="tdCor"><h:outputText value="#{bundle.lbl_visao}" /></td>
						<td class="tdBranco">
							<table style="width: 200px;">
     		 					<tr>
     		 						<td>
										<h:selectOneRadio value="#{crudBean.searchObject.statusVo.codigo}">
										   <f:selectItem itemValue="0" itemLabel="#{bundle.lbl_total}"/>   
										   <f:selectItem itemValue="1" itemLabel="#{bundle.lbl_aberto}"/>   
										</h:selectOneRadio>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
		<!-- Painel de Pesquisa - Fim -->
		

		<!-- Painel de Detalhe 1 (Detalhe Parcelas Cupom - Inicio -->
		<h:panelGroup id="panelGroupDeDetalhe2" rendered="#{crudBean.detailCupomDetalhe}">
			<f:subview id="viewDetalhe2">
				<table class="tabela">
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_data_venda}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.dataVendaVo.data}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_loja}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.lojaVo.estLojaVo.descricao}" />
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_bandeira}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.bandeiraVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_produto}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.produtoVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_numero_cartao}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.numeroCartao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_nsu}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.nsu}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_autorizacao}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.autorizacao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_valor_cupom}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.valorVenda}"/>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
		<!-- Painel de Detalhe 1 (Detalhe Parcelas Cupom - Fim -->

		<!-- Painel de Detalhe 2 (Movimentos Vendas Cupom - Inicio -->
		<h:panelGroup id="panelGroupDeDetalhe3" rendered="#{crudBean.agendaFinanceira}">
			<f:subview id="viewDetalhe3">
				<table class="tabela">
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_data_venda}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.dataVendaVo.data}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_loja}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.lojaVo.estLojaVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_bandeira}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.bandeiraVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_produto}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.produtoVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_quantidade_cupons}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.filtro.quantidade}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_valor_total}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.valorBruto}"/>
						</td>
					</tr>
				</table>
			</f:subview>
			
		</h:panelGroup>
		<!-- Painel de Detalhe 2 (Movimentos Vendas Cupom - Fim -->
		
		
		<!--  Painel de Visualizar o Cupom - Inicio -->
		<h:panelGroup id="visualizarCupom">
		
			<h:panelGroup rendered="#{crudBean.visualizarCupom}" id="visualizarCupomDentro" >
					<div id="Cupom">
					<div id="Cupom-top" />
					<div id="Cupom-center">
						<div id="Cupom-close" onclick="document.getElementById('Cupom').style.display='none';" />
						<div id="Cupom-data">
							<table style="width: 180px;">
							  <tr>
							    <td style="text-align: center; font-weight: bolder;" colspan="2"><b><h:outputText value="#{crudBean.entity.bandeiraVo.descricao}"/></b><br /><br /></td>
							  </tr>
							  <tr>
							    <td style="text-align: center;" colspan="2"><h:outputText value="#{crudBean.entity.numeroCartao}"/><br /><br /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;">DOC=<h:outputText value="#{crudBean.entity.nsu}"/></td>
							    <td style="text-align: right;">AUT=<h:outputText value="#{crudBean.entity.autorizacao}"/></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;">DATA:</td>
							    <td style="text-align: right;"><h:outputText value="#{crudBean.entity.dataVendaVo.data}"/></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">LOJA=<h:outputText value="#{crudBean.entity.lojaVo.estLojaVo.descricao}" /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">LOTE=<h:outputText value="#{crudBean.entity.numeroResumoVenda}" /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">PARCELAS=<h:outputText value="#{crudBean.entity.plano}" /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">BANCO=<h:outputText value="#{crudBean.entity.contaBancoVo.banco}" /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">AGENCIA=<h:outputText value="#{crudBean.entity.contaBancoVo.agencia}" /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">CONTA=<h:outputText value="#{crudBean.entity.contaBancoVo.conta}" /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;">VALOR:</td>
							    <td style="text-align: right;"><h:outputText value="#{crudBean.entity.valorVenda}"/><br /><br /></td>
							  </tr>
							  <tr>
							    <td style="text-align: left;" colspan="2">
							    	<table width="100%">
							    	<a4j:repeat value="#{crudBean.listaParcelasCupom}" var="par">  
                                		<tr>
                                		  <td style="text-align: center;" width="10%"><h:outputText value="#{par.parcela}" /></td>
                                		  <td style="text-align: right;" width="30%"><h:outputText value="#{par.dataCreditoVo.data}" /></td>
                                		  <td style="text-align: right;" width="35%"><h:outputText value="#{par.valorBruto}" /></td>
                                		  <td style="text-align: center;" width="25%"><h:outputText title="#{par.statusVo.descricao}" value="#{par.statusVo.descricaoResumida}" /></td>
                                		</tr>  
                            		</a4j:repeat>
                            		</table>  
							    </td>
							  </tr>
							</table>
						</div>
					</div>
					<div id="Cupom-buttom" />
					</div>
					
					<script type="text/javascript">
			
						//mantendo a div do cupom sempre no topo da pagina
						function refreshCupom()
						{
							
							var bodyTop = jQuery(window).scrollTop();
							
							
							if (eval(document.getElementById('Cupom'))) 
							{
								if (80 > bodyTop)
								{
									document.getElementById('Cupom').style.top = bodyTop + 80 + 'px';
								}
								else
								{
									document.getElementById('Cupom').style.top = bodyTop + 10 + 'px';
								}
							}
											
							setTimeout("refreshCupom()",100);
						}
						
						setTimeout("refreshCupom()",100);
			
					</script>
					
	        </h:panelGroup>
		
		</h:panelGroup>
		<!-- Painel de Visualizar o Cupom -  Fim -->
		
		<!-- Painel de Detalhe 3 (Movimentos Vendas Cupom - Inicio -->
		<h:panelGroup id="panelGroupDeDetalhe4" rendered="#{crudBean.detailCupom}">
			
			<f:subview id="viewDetalhe4">
				<table class="tabela">
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_data_venda}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.dataVendaVo.data}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_loja}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.lojaVo.estLojaVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_bandeira}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.bandeiraVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_produto}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.produtoVo.descricao}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_quantidade_cupons}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.filtro.quantidade}"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="15%"><h:outputText value="#{bundle.lbl_valor_total}" /></td>
						<td class="tdBranco" width="35%">
							<h:outputText value="#{crudBean.entity.valorBruto}"/>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
		<!-- Painel de Detalhe 3 (Movimentos Vendas Cupom - Fim -->
		
	</ui:define>
	
	<ui:define name="list">
		<h:panelGroup id="panelGroupDeListagem" rendered="#{crudBean.searching}">
			<f:subview id="viewListagem">
				<rich:dataTable id="tblData" value="#{crudBean.listaMovimentoVendasPorDataVenda}" binding="#{crudBean.tblData}" var="rst" style="width: 100%;" rowClasses="par,impar">
					<f:facet name="header">
						<rich:columnGroup>
							<rich:column style="text-align: center;">
								<h:outputText value="#{bundle.lbl_data_venda}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_bandeira}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_quantidade_cupons}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_total}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_administracao}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_liquido}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_taxa_administracao}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_ticket_medio}" />
							</rich:column>
							<rich:column style="text-align: center;">
								<h:outputText value="#{bundle.lbl_agenda_financeira}" />
							</rich:column>
							<rich:column style="text-align: center;">
								<h:outputText value="#{bundle.lbl_cupons}" />
							</rich:column>
						</rich:columnGroup>
					</f:facet>
					
					<rich:column style="text-align: center;">
						<h:outputText value="#{rst.dataVenda}"/>
					</rich:column>
					<rich:column>
						<h:outputText value="#{rst.bandeira}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.quantidade}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorTotalBruto}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorTotalAdministracao}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorTotalLiquido}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.taxaAdministracao}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorTicketMedio}"/>
					</rich:column>
					<rich:column style="text-align: center;">
						<a4j:commandLink actionListener="#{crudBean.detalharMovimentosVendasAgendaFinanceira}" ajaxSingle="true" reRender="formulario, panelTitle">
							<h:graphicImage value="/imagens/lupa.jpg" height="20" width="20" style="border: 0px;"/>
						</a4j:commandLink>
					</rich:column>
					<rich:column style="text-align: center;">
						<a4j:commandLink actionListener="#{crudBean.detalharMovimentosVendasCupom}" ajaxSingle="true" reRender="formulario, panelTitle">
							<h:graphicImage value="/imagens/lupa.jpg" height="20" width="20" style="border: 0px;"/>
						</a4j:commandLink>
					</rich:column>
					
					<f:facet name="footer">
                        <rich:columnGroup rendered="#{crudBean.viewingTotal}">
                        	<rich:column colspan="2" style="text-align: right;">
						     	<h:outputText value="#{bundle.lbl_total}" />
				 		    </rich:column>
                            <rich:column style="text-align: right;">
                                <h:outputText value="#{crudBean.entity.filtro.quantidade}"/>
                            </rich:column>
                            <rich:column style="text-align: right;">
                                <h:outputText value="#{crudBean.entity.valorBruto}"/>
                            </rich:column>
                            <rich:column style="text-align: right;">
                                <h:outputText value="#{crudBean.entity.valorPagoAdministracao}"/>
                            </rich:column>
                            <rich:column style="text-align: right;">
                                <h:outputText value="#{crudBean.entity.valorLiquido}"/>
                            </rich:column>
                            <rich:column style="text-align: right;">
                                <h:outputText value="#{crudBean.entity.valorComissao}"/>
                            </rich:column>
							<rich:column style="text-align: right;">
								<h:outputText value="#{crudBean.entity.valorTicketMedio}"/>
							</rich:column>
                            <rich:column></rich:column>
                            <rich:column></rich:column>
                        </rich:columnGroup>
                    </f:facet>
					
				</rich:dataTable>
			</f:subview>
		</h:panelGroup>
		
		<br/>
		<h:panelGroup id="panelGroupDeListagemAgendaFinanceira" rendered="#{crudBean.agendaFinanceira}">
			<f:subview id="viewListagemAgendaFinanceira">
				<rich:panel>
					<f:facet name="header">
						<h:outputText value="#{bundle.lbl_movimentos_vendas_agenda_financeira}" />
					</f:facet>
					<rich:dataTable id="tblDataAgendaFinanceira" value="#{crudBean.listaMovimentoVendasAgendaFinanceira}" binding="#{crudBean.tblDataAgendaFinanceira}" var="rst" style="width: 100%;" rowClasses="par,impar">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column style="width: 19%;">
									<h:outputText value="#{bundle.lbl_data_venda}" />
								</rich:column>
								<rich:column style="width: 19%;">
									<h:outputText value="#{bundle.lbl_data_credito}" />
								</rich:column>
								<rich:column style="text-align: rigth;">
									<h:outputText value="#{bundle.lbl_plano}" />
								</rich:column>
								<rich:column style="text-align: rigth;">
									<h:outputText value="#{bundle.lbl_quantidade_parcelas}" />
								</rich:column>
								<rich:column style="text-align: rigth;">
									<h:outputText value="#{bundle.lbl_valor_bruto}" />
								</rich:column>
								<rich:column style="text-align: rigth;">
									<h:outputText value="#{bundle.lbl_valor_administracao}" />
								</rich:column>
								<rich:column style="text-align: rigth;">
									<h:outputText value="#{bundle.lbl_valor_liquido}" />
								</rich:column>
								<rich:column style="text-align: rigth;">
									<h:outputText value="#{bundle.lbl_taxa_administracao}" />
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						
						<rich:column style="text-align: center;">
							<h:outputText value="#{rst.dataVenda}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<h:outputText value="#{rst.dataCredito}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<h:outputText value="#{rst.tipoPlano}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rst.quantidade}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rst.valorTotalBruto}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rst.valorTotalAdministracao}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rst.valorTotalLiquido}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rst.taxaAdministracao}"/>
						</rich:column>
						
						<f:facet name="footer">
                        	<rich:columnGroup rendered="#{crudBean.viewingTotal}">
                        		<rich:column colspan="3" style="text-align: right;">
						     		<h:outputText value="#{bundle.lbl_total}" />
				 		    	</rich:column>
                            	<rich:column style="text-align: right;">
                                	<h:outputText value="#{crudBean.entity.parcela}"/>
                            	</rich:column>
                            	<rich:column style="text-align: right;">
                                	<h:outputText value="#{crudBean.entity.valorBruto}"/>
                            	</rich:column>
                            	<rich:column style="text-align: right;">
                                	<h:outputText value="#{crudBean.entity.valorPagoAdministracao}"/>
                            	</rich:column>
                            	<rich:column style="text-align: right;">
                                	<h:outputText value="#{crudBean.entity.valorLiquido}"/>
                            	</rich:column>
                            	<rich:column style="text-align: right;">
                                	<h:outputText value="#{crudBean.entity.valorComissao}"/>
                            	</rich:column>
                        	</rich:columnGroup>
                    	</f:facet>
					</rich:dataTable>
				</rich:panel>
			</f:subview>
		</h:panelGroup>

		<br/>
		<h:panelGroup id="panelGroupDeListagemCupom" rendered="#{crudBean.detailCupom}">
			<f:subview id="viewListagemCupom">
				<rich:panel>
					<f:facet name="header">
						<h:outputText value="#{bundle.lbl_movimentos_vendas_cupom}" />
					</f:facet>
					<rich:dataTable id="tblDataCupom" value="#{crudBean.listaMovimentoVendasCupom}" binding="#{crudBean.tblDataCupom}" var="rstCup" style="width: 100%;" rows="20" rowClasses="par,impar">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column style="text-align: left;">
									<h:outputText value="#{bundle.lbl_loja}" />
								</rich:column>
								<rich:column style="text-align: center;">
									<h:outputText value="#{bundle.lbl_data_venda}" />
								</rich:column>
								<rich:column style="width: 19% text-align: right;">
									<h:outputText value="#{bundle.lbl_nsu}" />
								</rich:column>
								<rich:column style="width: 19% text-align: left;">
									<h:outputText value="#{bundle.lbl_autorizacao}" />
								</rich:column>
								<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_numero_cartao}" />
								</rich:column>
								<rich:column style="text-align: right;">
									<h:outputText value="#{bundle.lbl_valor_cupom}" />
								</rich:column>
								<rich:column style="text-align: right;">
									<h:outputText value="#{bundle.lbl_valor_administracao}" />
								</rich:column>
								<rich:column style="text-align: right;">
									<h:outputText value="#{bundle.lbl_valor_liquido}" />
								</rich:column>
								<rich:column style="text-align: right;">
									<h:outputText value="#{bundle.lbl_taxa_administracao}" />
								</rich:column>
								<rich:column style="text-align: center;">
									<h:outputText value="#{bundle.lbl_plano}" />
								</rich:column>
								<rich:column style="text-align: center;">
									<h:outputText value="#{bundle.lbl_parcelas}" />
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						
						<rich:column style="text-align: left;">
							<h:outputText value="#{rstCup.estLojaVo.descricao}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<h:outputText value="#{rstCup.dataVendaVo.data}"/>
						</rich:column>
						<rich:column style="text-align: right;">
  							<h:outputText value="#{rstCup.nsu}"/>
						</rich:column>
						<rich:column style="text-align: left;">
							<h:outputText id="autorizacaoCupom" value="#{rstCup.autorizacao}"/>
						</rich:column>
						<rich:column style="text-align: left;">
							<h:outputText value="#{rstCup.numeroCartao}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstCup.valorBruto}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstCup.valorPagoAdministracao}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstCup.valorLiquido}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstCup.valorComissao}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<h:outputText value="#{rstCup.plano}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<a4j:commandLink actionListener="#{crudBean.visualizarCupomVenda}" ajaxSingle="true" reRender="visualizarCupom">
								<h:graphicImage value="/imagens/lupa.jpg" height="20" width="20" style="border: 0px;"/>
							</a4j:commandLink>
						</rich:column>
						
						<f:facet name="footer">
							<rich:datascroller for="tblDataCupom" maxPages="20"></rich:datascroller>
						</f:facet>
					</rich:dataTable>
				</rich:panel>
			</f:subview>
		</h:panelGroup>

		<h:panelGroup id="panelGroupCupom" rendered="#{crudBean.detailCupomDetalhe}">
			<f:subview id="viewCupom">
				<rich:panel>
					<f:facet name="header">
						<h:outputText value="#{bundle.lbl_detalhar_cupom}" />
					</f:facet>
					<rich:dataTable id="tblDataCupom" value="#{crudBean.listaParcelasCupom}" binding="#{crudBean.tblDataParcelasCupom}" var="rstPar" style="width: 100%;" rowClasses="par,impar">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column style="text-align: left;">
									<h:outputText value="#{bundle.lbl_parcela}" />
								</rich:column>
								<rich:column style="text-align: center;">
									<h:outputText value="#{bundle.lbl_data_credito}" />
								</rich:column>
								<rich:column style="text-align: right;">
									<h:outputText value="#{bundle.lbl_valor_bruto}" />
								</rich:column>
								<rich:column style="width: 19% text-align: right;">
									<h:outputText value="#{bundle.lbl_valor_liquido}" />
								</rich:column>
								<rich:column style="width: 19% text-align: right;">
									<h:outputText value="#{bundle.lbl_valor_administracao}" />
								</rich:column>
								<rich:column style="text-align: right;">
									<h:outputText value="#{bundle.lbl_taxa_administracao}" />
								</rich:column>
								<rich:column style="width: 19% text-align: center;">
									<h:outputText value="#{bundle.lbl_situacao}" />
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						
						<rich:column style="text-align: center;">
							<h:outputText value="#{rstPar.parcela}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<h:outputText value="#{rstPar.dataCreditoVo.data}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstPar.valorBruto}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstPar.valorLiquido}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstPar.valorPagoAdministracao}"/>
						</rich:column>
						<rich:column style="text-align: right;">
							<h:outputText value="#{rstPar.valorComissao}"/>
						</rich:column>
						<rich:column style="text-align: center;">
							<h:outputText value="#{rstPar.statusVo.descricao}"/>
						</rich:column>
					</rich:dataTable>
				</rich:panel>
			</f:subview>
		</h:panelGroup>
		
	</ui:define>
	
	<ui:define name="buttonItens">
	
		<!-- Painel dos botoes de pesquisa -->
		
		<h:panelGroup rendered="#{crudBean.searching}">
			<a4j:commandButton value="#{bundle.lbl_search}" actionListener="#{crudBean.pesquisarMovimentosVendasPorDataVenda}" reRender="tblData"/>
			<h:outputText value=" "/>
			<h:commandButton value="#{bundle.lbl_export_planilha}" action="#{crudBean.exportExcel}" reRender="tblData"/>
		</h:panelGroup>

					
		<!-- Painel dos botoes de visualizacao / agenda financeira -->
		<h:panelGroup rendered="#{crudBean.viewing}">
			<h:outputText value=" "/>
			<a4j:commandButton value="#{bundle.lbl_voltar}" actionListener="#{crudBean.voltarAgendaToPrincipal}" reRender="formulario, panelTitle" />
			<h:outputText value=" "/>
			<h:commandButton value="#{bundle.lbl_export_planilha}" action="#{crudBean.exporteExcelAgendaFinanceira}" reRender="tblData"/>
		</h:panelGroup>

		<!-- Painel dos botoes de visualizacao -->
		<h:panelGroup rendered="#{crudBean.detailCupom}">
			<h:outputText value=" "/>
			<a4j:commandButton value="#{bundle.lbl_voltar}" actionListener="#{crudBean.voltarViewCuponsToPrincipal}" reRender="formulario, panelTitle" />
			<h:outputText value=" "/>
			<h:commandButton value="#{bundle.lbl_export_planilha}" action="#{crudBean.exportExcelMovimentosVendasCupom}" />
		</h:panelGroup>
		
		<!-- Painel dos botoes de visualizacao -->
		<h:panelGroup rendered="#{crudBean.detailCupomDetalhe}">
			<h:outputText value=" "/>
			<a4j:commandButton value="#{bundle.lbl_voltar}" actionListener="#{crudBean.voltarViewCupomDetalheToDetailCupom}" reRender="formulario, panelTitle" />
		</h:panelGroup>
		
	</ui:define>
	
</ui:composition>